home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 101-125 / 118 / empire / src / source.zoo / cmd_general3.d < prev    next >
Text File  |  1987-12-02  |  18KB  |  610 lines

  1. #include:util.g
  2. #empire.g
  3. #empfunc.g
  4.  
  5. /* globals needed by cmd_build: */
  6.  
  7. *char StartPtr;
  8. uint TotalCost;
  9. bool HadBridge, HadHarbor, CouldBuild;
  10.  
  11. /* ****************************** */
  12.  
  13. /*
  14.  * doBuild - part of cmd_build
  15.  */
  16.  
  17. proc doBuild(int r, c; Sector_t s)void:
  18.     [100] char buf;
  19.     channel output text promptChan;
  20.     int rSpan, cSpan;
  21.     uint cost;
  22.     Sector_t sSpan;
  23.     Ship_t sh;
  24.     ShipType_t typ;
  25.     char dir;
  26.  
  27.     if s.s_type = s_bridgeHead then
  28.     HadBridge := true;
  29.     if s.s_production = 127 and
  30.         ThisCountry*.c_money >= make(World.w_bridgeCost, int) then
  31.         CouldBuild := true;
  32.         open(promptChan, &buf[0]);
  33.         write(promptChan; "Bridge head at ", r, ',', c,
  34.           "; build span in what direction? (udlr) ");
  35.         close(promptChan);
  36.         if reqBridgeDirection(&dir, &buf[0]) then
  37.         rSpan := r;
  38.         cSpan := c;
  39.         case dir
  40.         incase 'u':
  41.             rSpan := rSpan - 1;
  42.         incase 'd':
  43.             rSpan := rSpan + 1;
  44.         incase 'l':
  45.             cSpan := cSpan - 1;
  46.         incase 'r':
  47.             cSpan := cSpan + 1;
  48.         esac;
  49.         readSector(rSpan, cSpan, sSpan);
  50.         if sSpan.s_type = s_water then
  51.             s.s_production := 0;
  52.             ThisCountry*.c_money :=
  53.                 ThisCountry*.c_money - World.w_bridgeCost;
  54.             TotalCost := TotalCost + World.w_bridgeCost;
  55.             sSpan.s_type := s_bridgeSpan;
  56.             sSpan.s_owner := ThisCountryNumber;
  57.             sSpan.s_efficiency := 100;
  58.             writeQuan(s, it_shells, 0);
  59.             sSpan.s_lastUpdate :=
  60.             CurrentTime() / (60 * 30) * (60 * 30);
  61.             writeSector(rSpan, cSpan, sSpan);
  62.             writeln(Chout; "Bridge span built over ",
  63.                 rSpan, ',', cSpan);
  64.             writeSector(r, c, s);
  65.         else
  66.             err("can only build bridge spans over water");
  67.         fi;
  68.         fi;
  69.     fi;
  70.     elif s.s_type = s_harbour then
  71.     HadHarbor := true;
  72.     open(promptChan, &buf[0]);
  73.     write(promptChan; s.s_production,
  74.           " production units in harbor at ", r, ',', c,
  75.           "; kind of ship? ");
  76.     close(promptChan);
  77.     if reqShipType(&typ, &buf[0]) then
  78.         cost := World.w_shipCost[typ];
  79.         if cost > s.s_production then
  80.         err("insufficient production units");
  81.         elif make(cost * World.w_shipCostMult, int) >
  82.             ThisCountry*.c_money then
  83.         err("you don't have enough money");
  84.         else
  85.         s.s_production := s.s_production - cost;
  86.         ThisCountry*.c_money :=
  87.             ThisCountry*.c_money - cost * World.w_shipCostMult;
  88.         TotalCost := TotalCost + cost * World.w_shipCostMult;
  89.         sh.sh_lastUpdate :=
  90.             CurrentTime() / (30 * 60) * (30 * 60);
  91.         sh.sh_price := 0;
  92.         sh.sh_type := typ;
  93.         sh.sh_fleet := '*';
  94.         sh.sh_owner := ThisCountryNumber;
  95.         sh.sh_efficiency := 50;
  96.         sh.sh_row := transRow(r);
  97.         sh.sh_col := transCol(c);
  98.         sh.sh_crew := 0;
  99.         sh.sh_shells := 0;
  100.         sh.sh_guns := 0;
  101.         sh.sh_planes := 0;
  102.         sh.sh_ore := 0;
  103.         sh.sh_bars := 0;
  104.         sh.sh_mobility := 0;
  105.         writeShip(World.w_shipNext, sh);
  106.         s.s_shipCount := s.s_shipCount + 1;
  107.         writeSector(r, c, s);
  108.         writeln(Chout; "Built ", getShipName(typ),
  109.             " number ", World.w_shipNext, " at ", r, ',', c);
  110.         World.w_shipNext := World.w_shipNext + 1;
  111.         fi;
  112.     fi;
  113.     fi;
  114.     InputPtr := StartPtr;
  115. corp;
  116.  
  117. proc cmd_build()bool:
  118.  
  119.     if reqSectors("Sectors to build in? ") then
  120.     skipBlanks();
  121.     StartPtr := InputPtr;
  122.     HadBridge := false;
  123.     HadHarbor := false;
  124.     CouldBuild := false;
  125.     TotalCost := 0;
  126.     pretend(scanSectors(doBuild), void);
  127.     if not HadBridge and not HadHarbor then
  128.         err("can only build at bridge spans or harbors");
  129.     elif HadBridge and not CouldBuild then
  130.         err("insufficient money/production");
  131.     elif TotalCost ~= 0 then
  132.         writeln(Chout; "That just cost you $", TotalCost, '!');
  133.     fi;
  134.     true
  135.     else
  136.     false
  137.     fi
  138. corp;
  139.  
  140. proc cmd_declare()bool:
  141.     uint country, what;
  142.  
  143.     if reqChoice(&what, "neutrality\ealliance\ewar\e",
  144.         "Enter relationship: ") and
  145.         doSkipBlanks() and
  146.         reqCountry(&country, "Declare with which country? ") then
  147.     if country = ThisCountryNumber then
  148.         err("your relation to yourself is none of Empire's concern");
  149.         false
  150.     else
  151.         if ThisCountry*.c_relations[country] = r_war then
  152.         news(n_disavow_war, ThisCountryNumber, country);
  153.         elif ThisCountry*.c_relations[country] = r_allied then
  154.         news(n_disavow_ally, ThisCountryNumber, country);
  155.         fi;
  156.         ThisCountry*.c_relations[country] := r_neutral + what;
  157.         news(
  158.         case r_neutral + what
  159.         incase r_neutral:
  160.             n_decl_neut
  161.         incase r_war:
  162.             n_decl_war
  163.         incase r_allied:
  164.             n_decl_ally
  165.         esac, ThisCountryNumber, country);
  166.         true
  167.     fi
  168.     else
  169.     false
  170.     fi
  171. corp;
  172.  
  173. proc cmd_lend()bool:
  174.     Loan_t loan;
  175.     uint loanNumber, loanee, amount, rate, duration;
  176.  
  177.     if ThisCountry*.c_money > 32767 then
  178.     loanNumber := 32767;
  179.     else
  180.     loanNumber := ThisCountry*.c_money;
  181.     fi;
  182.     if loanNumber = 0 then
  183.     err("you have no money to lend");
  184.     true
  185.     elif reqCountry(&loanee, "Country to loan to? ") and
  186.         doSkipBlanks() and
  187.         reqPosRange(&amount, loanNumber, "Amount to loan? ") and
  188.         doSkipBlanks() and
  189.         reqPosRange(&rate, 127, "Interest rate (max 127%)? ") and
  190.         doSkipBlanks() and
  191.         reqPosRange(&duration, 127, "Duration in days (max 127)? ") then
  192.     if loanee = ThisCountryNumber then
  193.         err("can't lend yourself money");
  194.         false
  195.     elif amount = 0 or duration = 0 then
  196.         err("loan cancelled");
  197.         false
  198.     else
  199.         loan.l_lastPay := CurrentTime() / (60 * 30) * (60 * 30);
  200.         loan.l_dueDate :=
  201.         loan.l_lastPay + (60 * 60 * 24) * make(duration, ulong);
  202.         loan.l_amount := amount;
  203.         loan.l_paid := 0;
  204.         loan.l_duration := duration;
  205.         loan.l_rate := rate;
  206.         loan.l_loaner := ThisCountryNumber;
  207.         loan.l_loanee := loanee;
  208.         loan.l_state := l_offered;
  209.         writeLoan(World.w_loanNext, loan);
  210.         telegramStart(DEITY, loanee);
  211.         writeln(TelegramChannel; &ThisCountry*.c_name[0],
  212.             " has offered you loan \#", World.w_loanNext, '.');
  213.         telegramEnd();
  214.         writeln(Chout; "You have offered loan \#", World.w_loanNext, '.');
  215.         World.w_loanNext := World.w_loanNext + 1;
  216.         true
  217.     fi
  218.     else
  219.     false
  220.     fi
  221. corp;
  222.  
  223. proc cmd_accept()bool:
  224.     Loan_t loan;
  225.     uint loanNumber, choice;
  226.  
  227.     if World.w_loanNext = 0 then
  228.     err("there are no loans yet");
  229.     false
  230.     elif reqPosRange(&loanNumber, World.w_loanNext - 1,
  231.              "Loan to accept? ") then
  232.     readLoan(loanNumber, loan);
  233.     if loan.l_loanee ~= ThisCountryNumber then
  234.         err("that loan is not offered to you");
  235.         false
  236.     elif loan.l_state ~= l_offered then
  237.         err("that loan is not an outstanding offer");
  238.         false
  239.     else
  240.         write(Chout; "Loan \#", loanNumber, " offered by ",
  241.           &Country[loan.l_loaner].c_name[0], " on ");
  242.         writeDate(loan.l_lastPay);
  243.         writeln(Chout;);
  244.         writeln(Chout; "Principal $", loan.l_amount, " at ", loan.l_rate,
  245.             "% interest lasting ", loan.l_duration, " days");
  246.         write(Chout; "This offer will be retracted if not accepted by ");
  247.         writeDate(loan.l_dueDate);
  248.         writeln(Chout;);
  249.         if make(loan.l_amount, long) > Country[loan.l_loaner].c_money then
  250.         writeln(Chout; &Country[loan.l_loaner].c_name[0],
  251.             " no longer has the funds...");
  252.         loan.l_amount := Country[loan.l_loaner].c_money;
  253.         writeln(Chout; "You may borrow $", loan.l_amount,
  254.             " on the same terms.");
  255.         fi;
  256.         InputPtr* := '\e';
  257.         while not reqChoice(&choice, "accept\edecline\epostpone\e",
  258.               "Accept/decline/postpone this loan? ") do
  259.         od;
  260.         telegramStart(DEITY, loan.l_loaner);
  261.         case choice
  262.         incase 0:
  263.         ThisCountry*.c_money := ThisCountry*.c_money + loan.l_amount;
  264.         Country[loan.l_loaner].c_money :=
  265.             Country[loan.l_loaner].c_money - loan.l_amount;
  266.         loan.l_paid := 0;
  267.         loan.l_lastPay := CurrentTime() / (60 * 30) * (60 * 30);
  268.         loan.l_dueDate := loan.l_lastPay +
  269.             (60 * 60 * 24) * make(loan.l_duration, ulong);
  270.         loan.l_state := l_outstanding;
  271.         writeLoan(loanNumber, loan);
  272.         writeln(TelegramChannel; "Loan \#", loanNumber,
  273.             " accepted by ", &ThisCountry*.c_name[0]);
  274.         news(n_make_loan, loan.l_loaner, ThisCountryNumber);
  275.         writeln(Chout; "You are now $", loan.l_amount,
  276.             " richer (sort of)");
  277.         incase 1:
  278.         loan.l_state := l_declined;
  279.         writeLoan(loanNumber, loan);
  280.         writeln(TelegramChannel; "Loan \#", loanNumber,
  281.             " declined by ", &ThisCountry*.c_name[0]);
  282.         writeln(Chout; "You declined loan \#", loanNumber);
  283.         incase 2:
  284.         writeln(TelegramChannel; "Loan \#", loanNumber,
  285.             " considered by ", &ThisCountry*.c_name[0]);
  286.         writeln(Chout; "Okay...");
  287.         esac;
  288.         telegramEnd();
  289.         true
  290.     fi
  291.     else
  292.     false
  293.     fi
  294. corp;
  295.  
  296. proc cmd_repay()bool:
  297.     Loan_t loan;
  298.     uint loanNumber, amount;
  299.     ulong now, due, lastPay, rate, regularTime, extraTime, owed;
  300.  
  301.     if World.w_loanNext = 0 then
  302.     err("there are no loans yet");
  303.     false
  304.     elif reqPosRange(&loanNumber, World.w_loanNext - 1,
  305.              "Repay which loan? ") then
  306.     readLoan(loanNumber, loan);
  307.     if loan.l_state ~= l_outstanding or
  308.         loan.l_loanee ~= ThisCountryNumber then
  309.         err("you don't owe any money on that loan");
  310.         false
  311.     else
  312.         now := CurrentTime() / (60 * 30);
  313.         due := loan.l_dueDate / (60 * 30);
  314.         lastPay := loan.l_lastPay / (60 * 30);
  315.         rate := make(loan.l_rate, ulong) * 1000;
  316.         rate := rate / (make(loan.l_duration, ulong) * (24 * 2));
  317.         if now <= due then
  318.         regularTime := now - lastPay;
  319.         extraTime := 0;
  320.         else
  321.         if lastPay <= due then
  322.             regularTime := due - lastPay;
  323.             extraTime := now - due;
  324.         else
  325.             regularTime := 0;
  326.             extraTime := now - lastPay;
  327.         fi;
  328.         fi;
  329.         owed := ((regularTime + extraTime * 2) * rate / 100 + 1000) *
  330.             loan.l_amount / 1000;
  331.         if owed > 65535 then
  332.         owed := 65535;
  333.         fi;
  334.         writeln(Chout; "You owe $", owed, " on that loan.");
  335.         skipBlanks();
  336.         if reqPosRange(&amount, owed, "Pay how much? ") then
  337.         if make(amount, long) > ThisCountry*.c_money then
  338.             err("you don't have that much money");
  339.         else
  340.             ThisCountry*.c_money := ThisCountry*.c_money - amount;
  341.             Country[loan.l_loaner].c_money :=
  342.             Country[loan.l_loaner].c_money + amount;
  343.             loan.l_lastPay := now * (60 * 30);
  344.             telegramStart(DEITY, loan.l_loaner);
  345.             if amount = owed then
  346.             writeln(TelegramChannel; &ThisCountry*.c_name[0],
  347.                 " paid off loan \#", loanNumber, " with $",
  348.                 amount);
  349.             loan.l_state := l_paidUp;
  350.             news(n_repay_loan, ThisCountryNumber, loan.l_loaner);
  351.             writeln(Chout; "Congratulations, you've paid off "
  352.                 "the loan!");
  353.             else
  354.             writeln(TelegramChannel; &ThisCountry*.c_name[0],
  355.                 " paid $", amount, " on loan \#", loanNumber);
  356.             owed := owed - amount;
  357.             if owed > 65535 then
  358.                 owed := 65535;
  359.             fi;
  360.             loan.l_amount := owed;
  361.             if amount > 65535 - loan.l_paid then
  362.                 amount := 65535 - loan.l_paid;
  363.             fi;
  364.             loan.l_paid := loan.l_paid + amount;
  365.             fi;
  366.             telegramEnd();
  367.             writeLoan(loanNumber, loan);
  368.         fi;
  369.         true
  370.         else
  371.         false
  372.         fi
  373.     fi
  374.     else
  375.     false
  376.     fi
  377. corp;
  378.  
  379. /*
  380.  * dumpLoan - part of cmd_ledger. Return 'true' if loan involves this user.
  381.  */
  382.  
  383. proc dumpLoan(uint loanNumber)bool:
  384.     Loan_t loan;
  385.     ulong now, due, lastPay, rate, regularTime, extraTime, owed;
  386.  
  387.     readLoan(loanNumber, loan);
  388.     if (loan.l_loaner = ThisCountryNumber or
  389.         loan.l_loanee = ThisCountryNumber) and
  390.         loan.l_state ~= l_declined and loan.l_state ~= l_paidUp then
  391.     writeln(Chout;);
  392.     writeln(Chout; "Loan \#", loanNumber, " from ",
  393.         &Country[loan.l_loaner].c_name[0], " to ",
  394.         &Country[loan.l_loanee].c_name[0]);
  395.     if loan.l_state = l_offered then
  396.         writeln(Chout; "(proposed) principal = $", loan.l_amount,
  397.             " interest rate = ", loan.l_rate,
  398.             "% duration (days) = ", loan.l_duration);
  399.         if loan.l_dueDate < CurrentTime() / (30 * 60) * (30 * 60) then
  400.         writeln(Chout; "This offer has expired");
  401.         loan.l_state := l_paidUp;
  402.         writeLoan(loanNumber, loan);
  403.         else
  404.         write(Chout; "Loan must be accepted by ");
  405.         writeDate(loan.l_dueDate);
  406.         writeln(Chout;);
  407.         fi;
  408.     else
  409.         now := CurrentTime() / (60 * 30);
  410.         due := loan.l_dueDate / (60 * 30);
  411.         lastPay := loan.l_lastPay / (60 * 30);
  412.         rate := make(loan.l_rate, ulong) * 1000;
  413.         rate := rate / (make(loan.l_duration, ulong) * (24 * 2));
  414.         if now <= due then
  415.         regularTime := now - lastPay;
  416.         extraTime := 0;
  417.         else
  418.         if lastPay <= due then
  419.             regularTime := due - lastPay;
  420.             extraTime := now - due;
  421.         else
  422.             regularTime := 0;
  423.             extraTime := now - lastPay;
  424.         fi;
  425.         fi;
  426.         owed := ((regularTime + extraTime * 2) * rate / 100 + 1000) *
  427.             loan.l_amount / 1000;
  428.         writeln(Chout; "Amount paid to date: $", loan.l_paid);
  429.         writeln(Chout; "Amount due if paid now: $", owed);
  430.         if extraTime = 0 then
  431.         writeln(Chout; "(if paid on due date): $",
  432.             ((due - lastPay) * rate / 100 + 1000) *
  433.                 loan.l_amount / 1000);
  434.         write(Chout; "Due date is: ");
  435.         writeDate(loan.l_dueDate);
  436.         writeln(Chout;);
  437.         else
  438.         writeln(Chout; " ** In Arrears **");
  439.         fi;
  440.     fi;
  441.     true
  442.     else
  443.     false
  444.     fi
  445. corp;
  446.  
  447. proc cmd_ledger()void:
  448.     uint loanNumber;
  449.     bool gotOne;
  450.  
  451.     if World.w_loanNext = 0 then
  452.     err("there are no loans yet");
  453.     elif InputPtr* = '\e' then
  454.     writeln(Chout; "        ... ", &ThisCountry*.c_name[0], " Ledger ...");
  455.     gotOne := false;
  456.     for loanNumber from 0 upto World.w_loanNext - 1 do
  457.         if dumpLoan(loanNumber) then
  458.         gotOne := true;
  459.         fi;
  460.     od;
  461.     if not gotOne then
  462.         writeln(Chout; "The slate is clean (i.e. no entries in ledger)");
  463.     fi;
  464.     elif getPosRange(&loanNumber, World.w_loanNext - 1) then
  465.     if not dumpLoan(loanNumber) then
  466.         writeln(Chout; "There is no entry in the ledger for loan \#",
  467.             loanNumber);
  468.     fi;
  469.     fi;
  470. corp;
  471.  
  472. proc cmd_collect()bool:
  473.     Loan_t loan;
  474.     Sector_t s;
  475.     uint loanNumber, loanee;
  476.     int r, c;
  477.     ulong now, due, lastPay, rate, regularTime, extraTime, owed, val;
  478.     ItemType_t it;
  479.  
  480.     if World.w_loanNext = 0 then
  481.     err("there are no loans yet");
  482.     false
  483.     elif reqPosRange(&loanNumber, World.w_loanNext - 1,
  484.              "Loan to collect on? ") then
  485.     readLoan(loanNumber, loan);
  486.     if loan.l_state ~= l_outstanding or
  487.         loan.l_loaner ~= ThisCountryNumber then
  488.         writeln(Chout; "You are not owed anything on that loan");
  489.         false
  490.     elif loan.l_dueDate >= CurrentTime() / (60 * 30) * (60 * 30) then
  491.         writeln(Chout; "There has been no default on loan \#", loanNumber);
  492.         false
  493.     else
  494.         loanee := loan.l_loanee;
  495.         now := CurrentTime() / (60 * 30);
  496.         due := loan.l_dueDate / (60 * 30);
  497.         lastPay := loan.l_lastPay / (60 * 30);
  498.         rate := make(loan.l_rate, ulong) * 1000;
  499.         rate := rate / (make(loan.l_duration, ulong) * (24 * 2));
  500.         if now <= due then
  501.         regularTime := now - lastPay;
  502.         extraTime := 0;
  503.         else
  504.         if lastPay <= due then
  505.             regularTime := due - lastPay;
  506.             extraTime := now - due;
  507.         else
  508.             regularTime := 0;
  509.             extraTime := now - lastPay;
  510.         fi;
  511.         fi;
  512.         owed := ((regularTime + extraTime * 2) * rate / 100 + 1000) *
  513.             loan.l_amount / 1000;
  514.         writeln(Chout; "You are owed $", owed, " on that loan");
  515.         skipBlanks();
  516.         if reqSector(&r, &c, "Confiscate which sector? ") then
  517.         if near(r, c, loanee, nil) then
  518.             readSector(r, c, s);
  519.             if s.s_owner ~= loanee then
  520.             writeln(Chout; &Country[loanee].c_name[0],
  521.                 " doesn't own sector ", r, ',', c);
  522.             else
  523.             pretend(updateSector(r, c, s), void);
  524.             val := (make(s.s_efficiency, uint) + 100) *
  525.                 case s.s_type
  526.                 incase s_sanctuary:
  527.                 incase s_capital:
  528.                 127
  529.                 incase s_ironMine:
  530.                 incase s_goldMine:
  531.                 incase s_harbour:
  532.                 incase s_fortress:
  533.                 incase s_radar:
  534.                 20
  535.                 incase s_bridgeHead:
  536.                 incase s_bridgeSpan:
  537.                 15
  538.                 incase s_wilderness:
  539.                 5
  540.                 default:
  541.                 10
  542.                 esac;
  543.             val := val + s.s_iron * 10;
  544.             val := val + s.s_gold * 10;
  545.             val := val + s.s_production * 10;
  546.             val := val + s.s_mobility * 10;
  547.             for it from it_first upto it_last do
  548.                 val := val + readQuan(s,it) * 10 * getItemCost(it);
  549.             od;
  550.             val := val * World.w_collectScale / 100;
  551.             writeln(Chout;
  552.                    "That sector (and its contents) is valued at $",
  553.                 val);
  554.             if val <= owed then
  555.                 s.s_owner := ThisCountryNumber;
  556.                 s.s_defender := NO_DEFEND;
  557.                 s.s_checkPoint := 0;
  558.                 Country[loanee].c_sectorCount :=
  559.                 Country[loanee].c_sectorCount - 1;
  560.                 ThisCountry*.c_sectorCount :=
  561.                     ThisCountry*.c_sectorCount + 1;
  562.                 if Country[loanee].c_sectorCount = 0 then
  563.                 Country[loanee].c_status := cs_dead;
  564.                 writeln(Chout; "You have just confiscated "
  565.                     "that country's last sector!!");
  566.                 fi;
  567.                 news(n_sieze_sector, ThisCountryNumber, loanee);
  568.                 telegramStart(DEITY, loanee);
  569.                 write(TelegramChannel; &ThisCountry*.c_name[0],
  570.                   " siezed ",
  571.                   unTransRow(loanee, transRow(r)), ',',
  572.                   unTransCol(loanee, transCol(c)));
  573.                 if val * 105 / 100 >= owed or
  574.                     val + 100 >= owed then
  575.                 news(n_repay_loan, ThisCountryNumber, loanee);
  576.                 writeln(TelegramChannel;
  577.                     " to satisfy loan \#", loanNumber);
  578.                 loan.l_state := l_paidUp;
  579.                 writeln(Chout; "That loan is now considered "
  580.                     "repaid");
  581.                 else
  582.                 owed := owed - val;
  583.                 loan.l_amount :=
  584.                     if owed > 65535 then 65535 else owed fi;
  585.                 val := val + loan.l_paid;
  586.                 loan.l_paid :=
  587.                     if val > 65535 then 65535 else val fi;
  588.                 loan.l_lastPay := now * (60 * 30);
  589.                 writeln(TelegramChannel;
  590.                     "in partial payment of loan \#",
  591.                     loanNumber);
  592.                 writeln(Chout; "You are still owed $", owed,
  593.                     " on loan \#", loanNumber);
  594.                 fi;
  595.                 telegramEnd();
  596.                 writeLoan(loanNumber, loan);
  597.             fi;
  598.             writeSector(r, c, s);
  599.             fi;
  600.         else
  601.             writeln(Chout; "You are not adjacent to ", r, ',', c);
  602.         fi;
  603.         fi;
  604.         true
  605.     fi
  606.     else
  607.     false
  608.     fi
  609. corp;
  610.